package com.cloud.rou.im.client.api;

import com.cloud.rou.im.client.bootstrap.ClientBootstrap;
import com.cloud.rou.im.client.context.UserContextHolder;
import com.cloud.rou.im.client.rest.ClientRestService;
import com.cloud.rou.im.client.user.UserInfo;
import com.cloud.rou.im.core.base.ResultVO;
import com.cloud.rou.im.msg.Msg;
import lombok.extern.slf4j.Slf4j;


/**
 * <p></p>
 *
 * @author GaoShuangWen
 */
@Slf4j
public class ClientApi {

    private ClientRestService restService = new ClientRestService();


    public ResultVO send(Msg msg) {
        /* */
       /* UserContextHolder.writeAndFlush(msg);
        ChatMsgDeliveredQueueExecutor instance = ChatMsgDeliveredQueueExecutor.instance();
        instance.startAndGetResult(msg);
        return instance.get();*/
        UserContextHolder.writeAndFlush(msg);
        return null;
    }

    public UserInfo login(String username, String password) {
        UserInfo userInfo = restService.login(username, password);
        ClientBootstrap clientBootstrap = new ClientBootstrap(userInfo);
        clientBootstrap.start();
        return userInfo;
    }


}
